package com.ds.extend.listener;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * ApplicationStartedEvent：spring boot启动监听类
   ApplicationEnvironmentPreparedEvent：环境事先准备
   ApplicationPreparedEvent：上下文context准备时触发
   ApplicationReadyEvent：上下文已经准备完毕的时候触发
   ApplicationFailedEvent：该事件为spring boot启动失败时的操作
 * @author qiuxl
 * 在普通Spring环境中，基于ApplicationListener的监听器的onApplicationEvent方法可能会被执行多次
 *
 */
@Component
public class ApplicationListenerTest implements ApplicationListener<ContextRefreshedEvent> {

//    @Autowired
//    private UserMapper userMapper;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        System.out.println("*************ApplicationListener<ContextRefreshedEvent> start************");
    }

}
